package com.lagou.page.listener;

import com.lagou.page.service.PageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author Fxz
 * @version 1.0
 * @date 2021-10-08 9:39
 */
@Slf4j
@RequiredArgsConstructor
@RabbitListener(queues = "page_create_queue")
@Component
public class PageQueueListener {

    private final PageService pageService;

    @RabbitHandler
    public void createPage(String spuId) {
        log.info("========================={}============================", spuId);
        pageService.createHtml(spuId);
    }

}
